package net.jiastudy.biz.targettask.entity;

import com.baomidou.mybatisplus.annotations.TableField;
import io.swagger.annotations.ApiModelProperty;
import net.jiastudy.biz.enums.AuditStatus;
import net.jiastudy.biz.enums.TargetTaskLevel;
import net.jiastudy.biz.enums.TaskProgress;
import net.jiastudy.biz.sys.entity.Dept;
import net.jiastudy.biz.sys.entity.File;
import net.jiastudy.biz.user.entity.User;
import net.jiastudy.core.base.BaseEntity;

import javax.validation.constraints.NotEmpty;
import java.util.List;
import java.util.Set;

public class TargetTask extends BaseEntity<TargetTask> {
    @ApiModelProperty(value = "id")
    private Long id;

    @ApiModelProperty(value = "year")
    private Long year;

    @NotEmpty(message = "标题不能为空")
    @ApiModelProperty(value = "标题")
    private String title;

    @NotEmpty(message = "来源不能为空")
    @ApiModelProperty(value = "来源")
    private String origin;

    @NotEmpty(message = "任务下达人不能为空")
    @ApiModelProperty(value = "任务下达人")
    private Long originator;

    @NotEmpty(message = "任务下达部门不能为空")
    @ApiModelProperty(value = "任务下达部门")
    private Long originatedDeptId;

    @NotEmpty(message = "任务接收部门不能为空")
    @ApiModelProperty(value = "任务接收部门")
    private Long receiveDeptId;

    @ApiModelProperty(value = "等级")
    private TargetTaskLevel level;

    @ApiModelProperty(value = "任务完成情况的详细描述")
    private String remark;

    @ApiModelProperty(value = "进度")
    private TaskProgress progress;

    @ApiModelProperty(value = "排序")
    private Integer seq;

    @ApiModelProperty(value = "审核状态")
    private AuditStatus status;

    @ApiModelProperty(value = "审核要素")
    private String assessmentElements;

    @ApiModelProperty(value = "考核标准")
    private String assessmentStandard;

    @ApiModelProperty(value = "任务链")
    private String taskChain;

    @ApiModelProperty(value = "创建人")
    private Long createdUserId;

    @ApiModelProperty(value = "上级任务")
    private Long parentId;

    @ApiModelProperty(value = "任务接收部门")
    @TableField(exist = false)
    private Dept receiveDept;

    @TableField(exist = false)
    @ApiModelProperty(value = "任务接收部门IDS")
    private Set<Long> receiveDeptIds;

    @ApiModelProperty(value = "任务下达部门")
    @TableField(exist = false)
    private Dept originatedDept;

    @ApiModelProperty(value = "任务下达人")
    @TableField(exist = false)
    private User originatedUser;

    @ApiModelProperty(value = "任务年度")
    @TableField(exist = false)
    private TaskYear taskYear;

    @ApiModelProperty(value = "附件ids")
    @TableField(exist = false)
    private Set<Long> fileIds;

    @ApiModelProperty(value = "attachmentId")
    private Long attachmentId;

    @ApiModelProperty(value = "考核状态")
    private Boolean isAssess;

    @TableField(exist = false)
    private List<File> files;

    @ApiModelProperty(value = "下一级任务名称")
    @TableField(exist = false)
    private Set<String> nextTaskNames;

    @TableField(exist = false)
    @ApiModelProperty(value = "布置的工作")
    private List<TargetWork> works;

    @TableField(exist = false)
    private Set<String> fileNames;
    
    @ApiModelProperty(value = "等级名称")
    private String levelName;

    public String getLevelName() {
        return levelName;
    }

    public void setLevelName(String levelName) {
        this.levelName = levelName;
    }

    public Set<String> getFileNames() {
        return fileNames;
    }

    public void setFileNames(Set<String> fileNames) {
        this.fileNames = fileNames;
    }

    public Set<String> getNextTaskNames() {
        return nextTaskNames;
    }

    public void setNextTaskNames(Set<String> nextTaskNames) {
        this.nextTaskNames = nextTaskNames;
    }

    public List<TargetWork> getWorks() {
        return works;
    }

    public void setWorks(List<TargetWork> works) {
        this.works = works;
    }

    public List<File> getFiles() {
        return files;
    }

    public void setFiles(List<File> files) {
        this.files = files;
    }

    public Set<Long> getReceiveDeptIds() {
        return receiveDeptIds;
    }

    public void setReceiveDeptIds(Set<Long> receiveDeptIds) {
        this.receiveDeptIds = receiveDeptIds;
    }

    public TaskYear getTaskYear() {
        return taskYear;
    }

    public void setTaskYear(TaskYear taskYear) {
        this.taskYear = taskYear;
    }

    public User getOriginatedUser() {
        if (null != originator) {
            User originatedUser = new User();
            originatedUser.setId(originator);
            originatedUser = originatedUser.selectById();

            return originatedUser;
        }

        return originatedUser;
    }

    public void setOriginatedUser(User originatedUser) {
        this.originatedUser = originatedUser;
    }

    public Dept getReceiveDept() {
        if (null != receiveDeptId) {
            Dept receiveDept = new Dept();
            receiveDept.setId(receiveDeptId);
            receiveDept = receiveDept.selectById();
            return receiveDept;
        }

        return receiveDept;
    }

    public void setReceiveDept(Dept receiveDept) {
        this.receiveDept = receiveDept;
    }

    public Dept getOriginatedDept() {
        if (null != originatedDeptId) {
            Dept originatedDept = new Dept();
            originatedDept.setId(originatedDeptId);
            originatedDept = originatedDept.selectById();
            return originatedDept;
        }

        return originatedDept;
    }

    public void setOriginatedDept(Dept originatedDept) {
        this.originatedDept = originatedDept;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getOrigin() {
        return origin;
    }

    public void setOrigin(String origin) {
        this.origin = origin;
    }

    public Long getOriginator() {
        return originator;
    }

    public void setOriginator(Long originator) {
        this.originator = originator;
    }

    public Long getOriginatedDeptId() {
        return originatedDeptId;
    }

    public void setOriginatedDeptId(Long originatedDeptId) {
        this.originatedDeptId = originatedDeptId;
    }

    public Long getReceiveDeptId() {
        return receiveDeptId;
    }

    public void setReceiveDeptId(Long receiveDeptId) {
        this.receiveDeptId = receiveDeptId;
    }

    public TargetTaskLevel getLevel() {
        return level;
    }

    public void setLevel(TargetTaskLevel level) {
        this.level = level;
    }

    public String getLevelDesc() {
        return level.getDesc();
    }

    public String getLevelDesc1() {
        if (level.getValue().equals(0)) {
            return "标题";
        } else if (level.getValue().equals(1)) {
            return "党政要点";
        } else if (level.getValue().equals(2)) {
            return "一级";
        } else if (level.getValue().equals(3)) {
            return "二级";
        }
        return null;
    }

    public Integer getSeq() {
        return seq;
    }

    public void setSeq(Integer seq) {
        this.seq = seq;
    }

    public AuditStatus getStatus() {
        return status;
    }

    public void setStatus(AuditStatus status) {
        this.status = status;
    }

    public String getStatusDesc() {
        return status.getDesc();
    }

    public String getAssessmentElements() {
        return assessmentElements;
    }

    public void setAssessmentElements(String assessmentElements) {
        this.assessmentElements = assessmentElements;
    }

    public String getAssessmentStandard() {
        return assessmentStandard;
    }

    public void setAssessmentStandard(String assessmentStandard) {
        this.assessmentStandard = assessmentStandard;
    }

    public Long getCreatedUserId() {
        return createdUserId;
    }

    public void setCreatedUserId(Long createdUserId) {
        this.createdUserId = createdUserId;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public Long getYear() {
        return year;
    }

    public void setYear(Long year) {
        this.year = year;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public TaskProgress getProgress() {
        return progress;
    }

    public void setProgress(TaskProgress progress) {
        this.progress = progress;
    }

    public String getProgressDesc() {
        if (null != progress) {
            return progress.getDesc();

        }

        return null;
    }

    public Set<Long> getFileIds() {
        return fileIds;
    }

    public void setFileIds(Set<Long> fileIds) {
        this.fileIds = fileIds;
    }

    public Long getAttachmentId() {
        return attachmentId;
    }

    public void setAttachmentId(Long attachmentId) {
        this.attachmentId = attachmentId;
    }

    public String getTaskChain() {
        return taskChain;
    }

    public void setTaskChain(String taskChain) {
        this.taskChain = taskChain;
    }

    public Boolean getAssess() {
        return isAssess;
    }

    public void setAssess(Boolean assess) {
        isAssess = assess;
    }
}
